<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The SimpleXMLIterator class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="simplexmlelement.xpath.html">« SimpleXMLElement::xpath</a></li>
      <li style="float: right;"><a href="simplexmliterator.current.html">SimpleXMLIterator::current »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.simplexml.html">SimpleXML</a></li>
    <li>The SimpleXMLIterator class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.simplexmliterator" class="reference">
 <h1 class="title">The SimpleXMLIterator class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.1.3, PHP 7, PHP 8)</p>


  <div class="section" id="simplexmliterator.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    The SimpleXMLIterator provides recursive iteration over all nodes of a <span class="classname"><a href="class.simplexmlelement.html" class="classname">SimpleXMLElement</a></span> object.
   </p>
  </div>


  <div class="section" id="simplexmliterator.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">SimpleXMLIterator</strong>
     </span>

     <span class="ooclass">
      <span class="modifier">extends</span>
       <a href="class.simplexmlelement.html" class="classname">SimpleXMLElement</a>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="simplexmliterator.current.html" class="methodname">current</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmliterator.getchildren.html" class="methodname">getChildren</a></span>(): <span class="type"><a href="class.simplexmliterator.html" class="type SimpleXMLIterator">SimpleXMLIterator</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmliterator.haschildren.html" class="methodname">hasChildren</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmliterator.key.html" class="methodname">key</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmliterator.next.html" class="methodname">next</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmliterator.rewind.html" class="methodname">rewind</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmliterator.valid.html" class="methodname">valid</a></span>(): <span class="type">bool</span></div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的方法 */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.addattribute.html" class="methodname">SimpleXMLElement::addAttribute</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$qualifiedName</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$namespace</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.addchild.html" class="methodname">SimpleXMLElement::addChild</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$qualifiedName</code></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$value</code><span class="initializer"> = <strong><code>null</code></strong></span></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$namespace</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><span class="type">?</span><span class="type"><a href="class.simplexmlelement.html" class="type SimpleXMLElement">SimpleXMLElement</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.asxml.html" class="methodname">SimpleXMLElement::asXML</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$filename</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><span class="type">string</span>|<span class="type">bool</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.attributes.html" class="methodname">SimpleXMLElement::attributes</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$namespaceOrPrefix</code><span class="initializer"> = <strong><code>null</code></strong></span></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$isPrefix</code><span class="initializer"> = <strong><code>false</code></strong></span></span>): <span class="type"><span class="type">?</span><span class="type"><a href="class.simplexmlelement.html" class="type SimpleXMLElement">SimpleXMLElement</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.children.html" class="methodname">SimpleXMLElement::children</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$namespaceOrPrefix</code><span class="initializer"> = <strong><code>null</code></strong></span></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$isPrefix</code><span class="initializer"> = <strong><code>false</code></strong></span></span>): <span class="type"><span class="type">?</span><span class="type"><a href="class.simplexmlelement.html" class="type SimpleXMLElement">SimpleXMLElement</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.count.html" class="methodname">SimpleXMLElement::count</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.getdocnamespaces.html" class="methodname">SimpleXMLElement::getDocNamespaces</a></span>(<span class="methodparam"><span class="type">bool</span> <code class="parameter">$recursive</code><span class="initializer"> = <strong><code>false</code></strong></span></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$fromRoot</code><span class="initializer"> = <strong><code>true</code></strong></span></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.getname.html" class="methodname">SimpleXMLElement::getName</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.getnamespaces.html" class="methodname">SimpleXMLElement::getNamespaces</a></span>(<span class="methodparam"><span class="type">bool</span> <code class="parameter">$recursive</code><span class="initializer"> = <strong><code>false</code></strong></span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.registerxpathnamespace.html" class="methodname">SimpleXMLElement::registerXPathNamespace</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$prefix</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespace</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.tostring.html" class="methodname">SimpleXMLElement::__toString</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.xpath.html" class="methodname">SimpleXMLElement::xpath</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$expression</code></span>): <span class="type"><span class="type">array</span>|<span class="type">null</span>|<span class="type"><span class="type false">false</span></span></span></div>

   }</div>

  </div>



  <div class="section">
   <h2 class="title">更新日志</h2>
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.0.0</td>
       <td>
        <span class="classname"><strong class="classname">SimpleXMLIterator</strong></span> implements
        <span class="interfacename"><a href="class.stringable.html" class="interfacename">Stringable</a></span> now.
       </td>
      </tr>

     </tbody>
    
   </table>

  </div>

 </div>

 











































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="simplexmliterator.current.html">SimpleXMLIterator::current</a> — Returns the current element</li><li><a href="simplexmliterator.getchildren.html">SimpleXMLIterator::getChildren</a> — Returns the sub-elements of the current element</li><li><a href="simplexmliterator.haschildren.html">SimpleXMLIterator::hasChildren</a> — Checks whether the current element has sub elements</li><li><a href="simplexmliterator.key.html">SimpleXMLIterator::key</a> — Return current key</li><li><a href="simplexmliterator.next.html">SimpleXMLIterator::next</a> — Move to next element</li><li><a href="simplexmliterator.rewind.html">SimpleXMLIterator::rewind</a> — Rewind to the first element</li><li><a href="simplexmliterator.valid.html">SimpleXMLIterator::valid</a> — Check whether the current element is valid</li></ul>
</div>
</div></div></body></html>